package com.bohua.intermediary.controller;

import com.bohua.intermediary.common.Lay;
import com.bohua.intermediary.common.Msg;
import com.bohua.intermediary.entity.SysDept;
import com.bohua.intermediary.service.SysDeptService;
import com.bohua.intermediary.vo.InputTreeVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * 控制器
 * @author qian
 * @email 1415261159@qq.com
 * @date 2019/01/19
 */
@Controller
@RequestMapping("/sysDept")
public class SysDeptController {
    @Resource
    private SysDeptService sysDeptService;

    @RequestMapping
    public String sysDept(){
        return "sysDept/sysDept";
    }
    @RequestMapping("/add")
    public String add(){
        return "sysDept/addSysDept";
    }

    @RequestMapping("/update")
    public String update(){
        return "sysDept/updateSysDept";
    }

    @RequestMapping("/getSysDepts")
    @ResponseBody
    public Lay getSysDepts(SysDept sysDept,Integer page,Integer limit){
        return sysDeptService.getSysDepts(sysDept,page,limit);
    }
    @RequestMapping("/addSysDept")
    @ResponseBody
    public Msg addSysDept(SysDept sysDept){
        return sysDeptService.addSysDept(sysDept);
    }

    @RequestMapping("/updateSysDept")
    @ResponseBody
    public Msg updateSysDept(SysDept sysDept){
        return sysDeptService.updateSysDept(sysDept);
    }

    @RequestMapping("/delSysDept")
    @ResponseBody
    public Msg delSysDept(SysDept sysDept){
        return sysDeptService.delSysDept(sysDept);
    }

    @RequestMapping("/getTree")
    @ResponseBody
    public List<InputTreeVo> getTree(SysDept sysDept){
        return sysDeptService.getList(sysDept);
    }

}
